<template>
  <div>
    <CartItem v-for="item in list" :key="item.id" :item="item" />
    <p>总价 {{totalPrice}}</p>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import CartItem from './CartItem'

export default {
  components: {
    CartItem
  },
  computed: {
    ...mapGetters('cart', {
      list: 'getCartList',
      totalPrice: 'totalPrice'
    })
  }
}
</script>